home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / BOLEUI32.PAK / ANSIAPI.H next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  5.8 KB  |  157 lines

  1. /*
  2.  * ansiapi.h
  3.  * This file contains prototypes of ANSI version of OLE apis
  4.  * and mapping fooA to foo
  5.  */
  6.  
  7. #ifndef _ANSIAPI_INCL
  8. #define _ANSIAPI_INCL
  9.  
  10. #define UNICODEOLE32
  11.  
  12. #ifdef WIN32S
  13. #if !defined(UNICODEOLE32)
  14. #pragma message("Compiling for 32bit ANSI Ole!\n");
  15. #endif
  16. #endif
  17.  
  18. #define WASANSI() {                                                           \
  19.                    OutputDebugString("\n\r\t\tUnicode string was ANSI!\r\n"); \
  20.                    Assert(0);                                                 \
  21.                    _asm { int 3 }                                             \
  22.                   }
  23.  
  24.  
  25.  
  26. #ifndef UNICODEOLE32
  27.  
  28. #define W2A(w, a, cb)     lstrcpy (a, w)
  29. #define A2W(a, w, cb)     lstrcpy (w, a)
  30.  
  31. #define FREELOCALSTRING(p)
  32. #define MAKE_STR_LOCAL_COPYW2A(s, l)  l = s
  33. #define MAKE_STR_LOCAL_COPYA2W(s, l)  l = s
  34.  
  35. #define OLESTRCPY                lstrcpy
  36. #define OLESTRCAT                lstrcat
  37. #define OLESTRLEN                lstrlen
  38. #define OLESTRCMP                lstrcmp
  39. #define OLESTRCMPI               lstrcmpi
  40.  
  41. #define DeleteFile_AW            DeleteFile
  42. #define _lopen_AW                _lopen
  43. #define _lcreat_AW               _lcreat
  44. #define GlobalAddAtom_AW         GlobalAddAtom
  45. #define GlobalGetAtomName_AW     GlobalGetAtomName
  46. #define RegOpenKey_AW            RegOpenKey
  47.  
  48. #define CoLoadLibraryA   CoLoadLibrary
  49.  
  50. #define StringFromCLSID2A    StringFromCLSID2
  51. #define StringFromIID2A      StringFromIID2
  52. #define StringFromGUID2A     StringFromGUID2
  53. #define CLSIDFromProgIDA     CLSIDFromProgID
  54. #define CLSIDFromStringA     CLSIDFromString
  55. #define ProgIDFromCLSIDA     ProgIDFromCLSID
  56. #define StringFromCLSIDA     StringFromCLSID
  57.  
  58. #define UtDupStringA2W       UtDupString
  59.  
  60. // Storage APIs
  61. #define StgOpenStorageA      StgOpenStorage
  62.  
  63. // IPersistFile ansi translation
  64.  
  65. #define IPersistFile_LoadA(pf, file, mode) (pf)->Load(file, mode)
  66.  
  67. // IMoniker ansi translation
  68.  
  69. #define IMoniker_GetDisplayNameA(pm, p1, p2, p3) (pm)->GetDisplayName(p1,p2,p3)
  70.  
  71. #define CreateFileMonikerA   CreateFileMoniker
  72.  
  73. #else  // UNICODEOLE32
  74.  
  75.  
  76. #define W2A(w, a, cb)     WideCharToMultiByte(                              \
  77.                                                CP_ACP,                      \
  78.                                                0,                           \
  79.                                                w,                           \
  80.                                                -1,                          \
  81.                                                a,                           \
  82.                                                cb,                          \
  83.                                                NULL,                        \
  84.                                                NULL)
  85.  
  86. #define A2W(a, w, cb)     MultiByteToWideChar(                              \
  87.                                                CP_ACP,                      \
  88.                                                0,                           \
  89.                                                a,                           \
  90.                                                -1,                          \
  91.                                                w,                           \
  92.                                                cb)
  93.  
  94.  
  95. #define FREELOCALSTRING(p)      delete (p)
  96. #define MAKE_STR_LOCAL_COPYW2A(s, l)  {                                   \
  97.                                       l = UtDupStringW2A(s);              \
  98.                                       if (!l) {                           \
  99.                                          return ResultFromScode(S_OOM);   \
  100.                                       }                                   \
  101.                                    }
  102.  
  103. #define MAKE_STR_LOCAL_COPYA2W(s, l)  {                                   \
  104.                                       l = UtDupStringA2W(s);              \
  105.                                       if (!l) {                           \
  106.                                          return ResultFromScode(S_OOM);   \
  107.                                       }                                   \
  108.                                    }
  109.  
  110. #define OLESTRCPY                lstrcpyW
  111. #define OLESTRCAT                lstrcatW
  112. #define OLESTRLEN                lstrlenW
  113. #define OLESTRCMP                lstrcmpW
  114. #define OLESTRCMPI               lstrcmpiW
  115.  
  116. #define DeleteFile_AW            DeleteFileW
  117. #define _lopen_AW                _lopenW
  118. #define _lcreat_AW               _lcreatW
  119. #define GlobalAddAtom_AW         GlobalAddAtomW
  120. #define GlobalGetAtomName_AW     GlobalGetAtomNameW
  121. #define RegOpenKey_AW            RegOpenKeyW
  122.  
  123. STDAPI_(HINSTANCE) CoLoadLibraryA(LPSTR lpszLibName, BOOL bAutoFree);
  124.  
  125. #define StringFromCLSID2A(rclsid, lpsz, cbMax) \
  126.     StringFromGUID2A(rclsid, lpsz, cbMax)
  127.  
  128. #define StringFromIID2A(riid, lpsz, cbMax) \
  129.     StringFromGUID2A(riid, lpsz, cbMax)
  130.  
  131.  
  132. STDAPI_(int)  StringFromGUID2A(REFGUID rguid, LPSTR lpsz, int cbMax);
  133. STDAPI        CLSIDFromProgIDA(LPCSTR szProgID, LPCLSID pclsid);
  134. STDAPI        CLSIDFromStringA(LPSTR lpsz, LPCLSID lpclsid);
  135. STDAPI        StringFromCLSIDA(REFCLSID rclsid, LPSTR FAR* lplpsz);
  136. STDAPI        ProgIDFromCLSIDA (REFCLSID clsid, LPSTR FAR* lplpszProgID);
  137.  
  138. LPWSTR UtDupStringA2W(LPCSTR pSrc);
  139. LPSTR  UtDupStringW2A(LPCWSTR pSrc);
  140.  
  141. // Storage APIs
  142. STDAPI StgOpenStorageA(LPCSTR pwcsName,IStorage FAR *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage FAR * FAR *ppstgOpen);
  143.  
  144. // IPersistFile ansi translation
  145.  
  146. HRESULT IPersistFile_LoadA(LPPERSISTFILE pIPF, LPSTR szFile, DWORD dwMode);
  147.  
  148. // IMoniker ansi translation
  149.  
  150. HRESULT IMoniker_GetDisplayNameA(LPMONIKER pm, LPBC p1, LPMONIKER p2, LPSTR FAR *p3);
  151.  
  152. //OLEAPI CreateFileMonikerA ( LPSTR lpszPathName, LPMONIKER FAR * ppmk );
  153.  
  154. #endif // !UNICODEOLE32
  155.  
  156. #endif //  _ANSIAPI_INCL
  157.